Billing and Shipping information
Get Countries
TheGetCountries
method gets a collection of all the countries configured within Ucommerce.
Usage
ITransactionLibrary transactionLibrary = Ucommerce.Infrastructure.ObjectFactory.Instance.Resolve<Ucommerce.Api.ITransactionLibrary>(); ICollection<Ucommerce.EntitiesV2.Country> countries = transactionLibrary.GetCountries();
Get Billing Information
The GetBillingInformation
method gets an OrderAddress
object containing the billing information
for the current customer.
Usage
Ucommerce.EntitiesV2.OrderAddress billingInformation = transactionLibrary.GetBillingInformation();
Get Shipping Information
The GetShippingInformation
method gets an OrderAddress
object containing the shipping information
for the current customer.
Usage
Ucommerce.EntitiesV2.OrderAddress shippingInformation = transactionLibrary.GetShippingInformation();
Parameters
Parameter | Type | Details |
---|---|---|
address | string | Optional. Used for defining the name identifying the OrderAddress used for shipping |
Edit Billing Information
The EditBillingInformation
method is used for setting the billing information for the current customers basket.
The EditBillingInformation
method creates a new OrderAddress
object with the name "Billing", and sets
it as the billing address of the current customers basket.
Usage
transactionLibrary.EditBillingInformation( firstName: "Joe", lastName: "Developer", emailAddress: "[email protected]", phoneNumber: "12345678", mobilePhoneNumber:"12345678", company: "Ucommerce", line1: "line 1", line2: "line2", postalCode: "8000", city: "city", state: "state", attention: "Joe developer", countryId: 1);
Parameters
Parameter | Type | Details |
---|---|---|
firstName | string | Customers first name |
lastName | string | Customers last name |
emailAddress | string | Customers email address |
phoneNumber | string | Customers phone number |
mobilePhoneNumber | string | Customers mobile phone number |
company | string | Customers company |
line1 | string | Customers address line 1 |
line2 | string | Customers address line 2 |
postalCode | string | Customers postal code |
city | string | Customers city |
state | string | Customers state |
attention | string | Attention field |
countryId | int | Id of the customers country |
Edit Shipping Information
The EditShippingInformation
method is used for setting the shipping information for the current customers basket.
The EditShippingInformation
method creates a new OrderAddress
object with the name "Shipment"
using the default shipping method, and sets it as the shipping address of the current customers basket.
If no shipping method exists for the current product catalog, an exception is thrown.
Usage
transactionLibrary.EditShippingInformation( firstName: "Joe", lastName: "Developer", emailAddress: "[email protected]", phoneNumber: "12345678", mobilePhoneNumber:"12345678", company: "Ucommerce", line1: "line 1", line2: "line2", postalCode: "8000", city: "city", state: "state", attention: "Joe developer", countryId: 1);
Parameters
Parameter | Type | Details |
---|---|---|
firstName | string | Customers first name |
lastName | string | Customers last name |
emailAddress | string | Customers email address |
phoneNumber | string | Customers phone number |
mobilePhoneNumber | string | Customers mobile phone number |
company | string | Customers company |
line1 | string | Customers address line 1 |
line2 | string | Customers address line 2 |
postalCode | string | Customers postal code |
city | string | Customers city |
state | string | Customers state |
attention | string | Attention field |
countryId | int | Id of the customers country |
Get Shipping Methods
The GetShippingMethods
method gets a collection of shipping methods available for the current country.
Usage
ICollection<ShippingMethod> shippingMethods = transactionLibrary.GetShippingMethods();
Parameters
Parameter | Type | Details |
---|---|---|
country | Country | Optional. Used for specifying which country to get the shipping methods from |
Create Shipment
The ´CreateShipment` method is used for creating a new shipment for the current customers basket.
The new shipment will overwrite any existing shipment, with the same OrderAddress
name.
Usage
//address name is specified in case you're dealing with multiple shipments. Usually you're good with just defaultshipmentname as //the likelyness of having more shipments per checkout is rare. transactionLibrary.CreateShipment(shippingMethodId: 1, Constants.DefaultShipmentAddressName);
Parameters
Parameter | Type | Details |
---|---|---|
shippingMethodId | int | The id of the shipping method to use for the shipment. |
addressName | string | Used for identifying the OrderAddress used for the shipment. |
overwriteExisting | bool | Optional. If the new shipment should overwrite the existing shipment. |
Update the basket
After modifying the basket, please execute the basket pipeline.
transactionLibrary.ExecuteBasketPipeline();